﻿<!DOCTYPE html>
<!--作业分析表-->
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
        <script src="/static/js/common.js"></script>

    <script src="../../static/js/Mock/JobLicenseApp.js"></script>
    <script src="../../static/js/Resource/JobLicenseApp.js"></script>
    <style>
        body {
            padding-bottom: 10px;
        }

        .toptitle label {
            margin-left: 20px;
        }

        .align_left {
            text-align: left;
        }

        table {
            width: 100%;
            border-top: 1px solid;
            border-left: 1px solid;
            text-align: center;
            /*border-right: none;*/
        }

        table td {
            border-right: 1px solid;
            border-bottom: 1px solid;
            /*height:38px;*/
            padding: 10px;
        }
    </style>
</head>

<body>
    
<div id="app" v-cloak>   
        <div style="width:100%;text-align:center ">
            <label style="font-weight:bold">作业前安全分析（JSA）表</label>
        </div>
        <div style="width:100%;text-align:right" class="toptitle">
            <label style="float:left;">{{JobSafetyAnalysisList.UseUnit+mark.m}} {{Form.UseUnitValue}}</label>
            <label> {{Form.ApplicationTime}}</label>
            <label> {{JobSafetyAnalysisList.HeadNumber}}</label>
            <label>No.： {{Form.ApplicationNumberValue}}</label>
        </div>
        <el-form :model="Form" status-icon style="margin-top:5px;width:100%" :rules="rules" ref="ruleForm">
            <table cellpadding="0" cellspacing="0" style="">
                <tr>
                    <td>
                        <span
                            style="float:left;width:50%;text-align:left;">{{JobSafetyAnalysisList.ApplicationTime+mark.m}}
                            {{Form.ApplicationTime}}</span>
                        <span style="float:left;width:50%;text-align:left;">{{JobSafetyAnalysisList.JobManagere+mark.m}}
                            {{Form.JobManagere}}</span>
                    </td>
                </tr>
                <tr>
                    <td class="align_left">
                        {{JobSafetyAnalysisList.WorkDescription+mark.m}}{{Form.WorkDescription}}
                    </td>
                </tr>
                <tr>
                    <td class="align_left">
                        {{JobSafetyAnalysisList.PersonalProtectiveEquipment+mark.m}}{{Form.PersonalProtectiveEquipment}}
                    </td>
                </tr>
                <tr>
                    <td>
                        <span style="text-align:left;width:100%;float:left;">
                            {{JobSafetyAnalysisList.RiskIdentificationSafety+mark.m}}</span>
                        <br>
                        <br>
                        <table cellpadding="0" cellspacing="0">
                            <tr>
                                <td width="10%">{{JobSafetyAnalysisList.id}}</td>
                                <td width="25%">{{JobSafetyAnalysisList.WorkProcedure}}</td>
                                <td width="25%">{{JobSafetyAnalysisList.RiskDiscern}}</td>
                                <td width="40%">{{JobSafetyAnalysisList.SafetyStep}}</td>
                            </tr>
                            <tr v-for="(v,i) in Form.RiskIdentificationSafety">
                                <td>{{i+1}}</td>
                                <td>{{v.WorkProcedure}}</td>
                                <td>{{v.RiskDiscern}}</td>
                                <td>{{v.SafetyStep}}</td>
                            </tr>
                        </table>

                    </td>
                </tr>
                <tr>
                    <td>
                        <span style="float:left;">
                            {{JSPAnalyticalManagement.ParticipateJSPAnalysts+mark.m}}
                        </span>
                        <span style="float: left;margin: -5px 10px;height: 40px;">
                            <signature v-model="Form.Approval" :disabled="false"></signature>
                        </span>
                        <table cellpadding="0" cellspacing="0">
                            <tr>
                                <td width="10%">{{JobSafetyAnalysisList.id}}</td>
                                <td width="25%">{{JobSafetyAnalysisList.Unit}}</td>
                                <td width="25%">{{JobSafetyAnalysisList.JSPAnalyst}}</td>
                                <td width="40%">{{JobSafetyAnalysisList.ParterSignAndDate}}</td>
                            </tr>
                            <tr v-for="(v,i) in Form.ParticipateJSPAnalysts">
                                <td>{{i+1}}</td>
                                <td>{{v.Unit}}</td>
                                <td>{{v.JSPAnalyst}}</td>
                                <td>
                                    <span style="width:50%;float:left;text-align:center;">
                                        <signature v-model="SignValue" :disabled="false"></signature>
                                    </span>
                                    <span style="width:50%;float:left;text-align:center;">{{v.ParterDate}}</span>
                                </td>
                            </tr>
                        </table>

                    </td>
                </tr>

                <tr>
                    <td>
                        <span
                            style="float:left;width:50%;text-align:left;">{{JobSafetyAnalysisList.NotJoinJSAPerson+mark.m}}
                            <a v-for="v in Form.NotJoinJSAPerson">{{v.name}}&nbsp;&nbsp;&nbsp;&nbsp;</a>
                        </span>
                        <span style="float:left;width:50%;text-align:left;">{{JobSafetyAnalysisList.Approval+mark.m}}
                            <signature v-model="SignValue" :disabled="false"></signature></span>
                    </td>
                </tr>
            </table>
            <!--下方按钮-->
            <el-row>
                <el-form-item style="text-align:center; padding-top:5px">
                    <!--保存-->
                    <el-button type="primary" @click="onSubmitForm('ruleForm')">{{col.btnSave}}</el-button>
                    <!--提交-->
                    <el-button type="primary" @click="onSubmitForm('ruleForm')">{{col.btnCommit}}</el-button>
                    <el-button type="primary" @click="parent.ListItem.dialogVisible=false">{{col.btnBack}}</el-button>
                </el-form-item>
            </el-row>
        </el-form>

    </div>
    <script type="text/javascript">
        app = new Vue({
            el: '#app',
            data: {
                SignValue: '/static/images/signature.png',
                id: '123',
                Form: {
                    UseUnitValue: '',
                    ApplicationTime: '',
                    ApplicationNumber: '',
                    ParticipateJSPAnalysts: [],
                    RiskIdentificationSafety: [],
                    NotJoinJSAPerson: [],
                    Approval: '',
                },
                rules: {},
                ListItem: ListItem,
            },
            methods: {
                //解決edge下select bug
                visibleChange: function (isVisible) {
                    visibleChange(isVisible)
                },
                handleNodeClick: function (data) {
                    console.log(data);
                },
                //此处需要更改为公用JS下api
                getData: function () {
                    getData(this, '/api/JobLicenseApp/get?id=' + this.id);
                },
                //提交数据
                onSubmitForm: function (formName) {
                    var mythis = this;
                    //this.$refs[formName].validate(function (valid) {
                    //    //验证通过
                    //    if (valid) {
                    onSubmitForm(this, '/api/JobLicenseApp/Save', mythis.Form);
                    //} else {
                    //    //验证失败
                    //    return false;
                    //}
                    //});
                },
            },
            mounted: function () {
                this.id = getUrlParam("id");
                this.getData();
                //if (this.id == null) {
                var dateTime = new Date();
                //getData(this, '/api/JobLicenseManagement/getA?id=' + this.id);
                this.Form.UseUnitValue = "动力车间";
                this.Form.ApplicationTime = dateTime.getFullYear() + "-" + dateTime.getMonth() + "-" + dateTime.getDate();
                this.Form.ApplicationNumberValue = "001";
                this.Form.JobManagere = "张三";
                this.Form.WorkDescription = "这是一个工作内容的描述"
                this.Form.PersonalProtectiveEquipment = '这是一个要求和建议的个人防护用具'

                for (var i = 0; i < 5; i++) {
                    this.Form.RiskIdentificationSafety.push({
                        WorkProcedure: '步骤' + (i + 1),
                        RiskDiscern: '风险识别' + i,
                        SafetyStep: '安全措施实施方法' + i,
                    })
                }


                for (var i = 0; i < 5; i++) {
                    this.Form.ParticipateJSPAnalysts.push({
                        Unit: '某单位' + i,
                        JSPAnalyst: Mock.Random.cname(),
                        ParterSign: Mock.Random.cname(),
                        ParterDate: Mock.Random.date()
                    })
                }

                for (var i = 0; i < 3; i++) {
                    this.Form.NotJoinJSAPerson.push({
                        name: Mock.Random.cname()
                    })
                }
                //}
            }
        });
    </script>
</body>

</html>